const path = require("path");
function resolve(dir) {
  return path.join(__dirname, "..", dir);
}

module.exports = {
  devServer: {
    port: "8080",
    open: false,
    proxy: {
      "/api": {
        target: "http://www.ztwlxx.cn/api",
        ws: true,
        changeOrigin: true,
        pathRewrite: {
          "^/api": ""
        }
      }
    }
  },

  chainWebpack: config => {
    config.resolve.alias
      .set("@", resolve("new_shop/src"))
      .set("shop", resolve("new_shop/src/views/main/shop"))
      .set("publicPage", resolve("new_shop/src/views/main/publicPage"))
      .set("publicCom", resolve("new_shop/src/components/publicCom"))
      .set("comMain", resolve("new_shop/src/components/main"));
  },

  configureWebpack: {
    externals: {
      AMap: "AMap",
      AMapUI: "AMapUI"
    }
  },
  productionSourceMap: false
};
